<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <p>{{ msg | ms('疯狂')}}1</p>
        <input type="text" v-focus v-color="'red'">
    </div>
</body>
<script src="./vue.js"></script>
<script>

    Vue.filter('ms', function (msg, arg) {
        return msg.replace(/傻/g, arg)
    })
    Vue.directive('color', {
        bind: function (el, binding) {
            el.style.color = binding.value
        }
    })
    // 定义全局过滤器
    Vue.directive('focus', {
        inserted: function (el) {
            el.focus()
        }
    })
    let vm = new Vue({
        el: '#app',
        data() {
            return {
                msg: '我是一个傻的人,你上班不是傻'
            }
        },
    })


</script>

</html>